﻿using System.Collections.Generic;

namespace TestUp.Models.TestWorkers.TestsModel
{
    public class MatchTest : TestQuestion
    {
        /// <summary>
        /// [string, int] - [left statement text, corresponding right statement id]
        /// </summary>
        public List<Pair<string, int>> LeftStatements { get; set; }

        /// <summary>
        /// [int, string] - [right statement id, right statement text]
        /// </summary>
        public Dictionary<int, string> RightStatements { get; set; }

        public MatchTest()
        {
            TestType = TestTypes.MatchTest;
            LeftStatements = new List<Pair<string, int>>();
            RightStatements = new Dictionary<int, string>();
        }

        public bool Check(List<int> rightCorresponders)
        {
            for (int i = 0; i < LeftStatements.Count; i++)
            {
                if (LeftStatements[i].Item2 != rightCorresponders[i])
                    return false;
            }
            return true;
        }
    }
}